# coding: utf-8
from PySide6.QtWidgets import QApplication
from qfluentwidgets import InfoBar


class Alert:
    @classmethod
    def showMessage(cls, level: str, msg: str):
        getattr(InfoBar, level)('', msg, duration=2000, parent=QApplication.activeWindow())

    @classmethod
    def info(cls, msg: str):
        cls.showMessage('info', msg)

    @classmethod
    def warning(cls, msg: str):
        cls.showMessage('warning', msg)

    @classmethod
    def error(cls, msg: str):
        cls.showMessage('error', msg)

    @classmethod
    def success(cls, msg: str):
        cls.showMessage('success', msg)
